<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/view/system/common/head.jsp"%>
<script type="text/javascript" src="asserts/system/js/sysUser/sysUser.js"></script>
<style>
 .labelTd{
    width:100px;
    text-align:right;
 }
</style>
<body>
		<form id="userAddForm" name="userAddForm" method="post">
				<table class="infoTable">
					
				 <tr>
					<td class="labelTd">分组<span class="colrRed"> * </span>：</td>
					<td >
				    <select name="groupid" id="groupid" style="width:200px;" ></select>
					</td>
					</tr>
					<tr>
						<td class="labelTd">
							用户名<span class="colrRed"> * </span>：
						</td>
						<td >
							<input type="text" id="newUser_username" name="username"
							   class="easyui-validatebox myinput" 
								
								
								required="true" 
								missingMessage="请输入用户名"  placeholder="请输入用户名" />
						</td>
					</tr>
					
					<tr>
					<td class="labelTd">
							工号<span class="colrRed"> * </span>：
						</td>
						<td >
							<input type="text" id="newUser_code" name="code"
								maxlength="8" class="easyui-validatebox myinput" 
								precision="0" min="1" max="99999999"
								
								 required="true" 
								missingMessage="请输入用户工号"  placeholder="请输入用户工号"/>
						</td>
					</tr>
					
					<tr>
					
						<td class="labelTd">
							用户密码<span class="colrRed"> * </span>：
						</td>
						<td >
							<input type="text" id="newUser_password" name="password"
								required="true" 
								 class="easyui-validatebox myinput"  
								 missingMessage="请输入用户密码"  placeholder="请输入用户密码"/>
						</td>
					</tr>
					
					<tr>
						<td class="labelTd">
							姓名<span class="colrRed"> * </span>：
						</td>
						<td >
							<input type="text" id="newUser_name" name="name"
								 maxlength="30" class="easyui-validatebox myinput" 
								 required="true" validType="length[1,30]" 
								 missingMessage="请输入用户姓名"  placeholder="请输入用户姓名"/>
						</td>
						
					</tr>
			
					<tr>
						<td class="labelTd">
							身份证号 :
						</td>
						<td >
							<input type="text" id="newUser_idcard" name="idcard"
								maxlength="30" class="easyui-validatebox  myinput" 
								placeholder="请输入用户身份证" />
						</td>
					</tr>
				
					<tr>
						<td class="labelTd">
							手机 :
						</td>
						<td >
							<input type="text" id="newUser_telephone"
								name="telephone" class="easyui-validatebox myinput" 
								placeholder="请输入用户手机" />
						</td>
					</tr>
					<tr>
						<td class="labelTd">
							地址 :
						</td>
						<td >
							<textarea class="easyui-validatebox" id="newUser_address"
								name="address"  rows="3" 
								cols="50" ></textarea>
						</td>
					</tr>

					<tr>
						<td class="labelTd">
							备注 :
						</td>
						<td >
							
								<textarea class="easyui-validatebox" id="newUser_descr"
								name="descr"  rows="3" 
								cols="50" ></textarea>
						</td>
					</tr>
					<tr>
					<td class="labelTd">
							角色 :
						</td>
						<td style="padding-top:10px;">
					<table id="dataShow" > </table>
					</td>
					</tr>
					
				</table>
				
			
			<div style="text-align:center;padding-top:10px;">
			
				<a class="easyui-linkbutton myLink" iconCls="icon-ok"
					onclick="addUser()">新增 </a>
				&nbsp;&nbsp;&nbsp;
				<a class="easyui-linkbutton myLink" iconCls="icon-undo"
					onclick="resetFormNoGroup()">重置 </a>
			</div>
		</form>
		

</body>
<script>

$(document).ready(function() {
	setDataGridList();
	setTreeGridList();
});
//查询列表初始化
function setDataGridList() {
	$('#dataShow').datagrid( {
		url : 'role/getRoleList.action',
		title : "角色列表",
		fitColumns : true,
		nowrap : false,
		rownumbers : true,
		showFooter : false,
		pagination : true,
		striped : true,
		singleSelect : true,
		idField : 'id',
		frozenColumns : [ [ {
			field : 'ck',
			checkbox : true
		} ] ],
		columns : [ [ {
			field : 'id',
			hidden : true,
			sortable:false
		}, {
			field : 'name',
			title : "名称",
			width : '90%',
			sortable:false
		} ] ],
		tools : [ {
			iconCls : 'icon-reload',
			handler : function() {
				$('#dataShow').datagrid('reload');
			}
		} ]
	});
}

function setTreeGridList(){
	$('#groupid').combotree({
		url:'usergroup/getGroupList.action',
		method: 'post',
		checkbox: true,
		textField:'text',
		valueField: 'id',
		required:true,
		onClick:function(node){  
            $("input[name='role.fatherId']").val(node.id);  
        },  
        checkbox:false,  
        multiple:false,
        message:'请选择分组',
        missingMessage:'请选择分组'
	   
	});
}

</script>
</html>